<%--
  Created by IntelliJ IDEA.
  User: xh
  Date: 2020/2/8
  Time: 15:46
  To change this template use File | Settings | File Templates.
--%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page isELIgnored="false"%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta charset="UTF-8">
    <title>提问题 - 技术栈 -Java程序员成长平台</title>
    <meta name="keywords" content="">
    <meta name="description" content>
    <link rel="stylesheet" href="${APP_PATH}/vendor/layui-v2.4.5/layui/css/layui.css">
    <link rel="stylesheet" href="${APP_PATH}/css/common.css">
    <link rel="stylesheet" href="${APP_PATH}/css/header.css">
    <link rel="stylesheet" href="${APP_PATH}/css/footer.css">
    <link rel="stylesheet" href="${APP_PATH}/css/blog-add.css">
    <link rel="stylesheet" href="${APP_PATH}/vendor/layui-v2.4.5/layui-formSelects/dist/formSelects-v4.css">
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body>
<jsp:include page="head.jsp"></jsp:include>

<div class="layui-main g-main">
    <div class="layui-row layui-col-space30">
        <form class="layui-form" action="${APP_PATH}/question/doAdd" id="form2">
        <div class="layui-col-xs12">
            <blockquote class="layui-elem-quote">向&nbsp;
                <select id="sel" name="forwardId">
                    <c:forEach items="${requestScope.users}" var="user">
                        <c:if test="${user.id!=sessionScope.user.id}">
                        <option value="${user.id}">${user.username}</option>
                        </c:if>
                    </c:forEach>
                </select>
            &nbsp;提问</blockquote>

                <div class="layui-form-item">
                    <input type="hidden" value="${sessionScope.user.id}" id="userId" name="userId">
                    <input type="text" id="title" name="title" placeholder="问题标题：一句话清楚问题" autocomplete="off" class="layui-input">
                </div>
                <div class="layui-form-item">
                    <select class="layui-select" xm-select="tag-select" id="systemType" xm-select-radio>
                        <option value="">系统分类：请准确选择标签（重要）</option>
                        <option value="windows">windows</option>
                        <option value="linux">linux</option>
                        <option value="3">3</option>
                        <option value="4">4</option>
                    </select>
                </div>
                <div class="layui-form-item">
                                            <textarea name="main" id="description" class="layui-textarea" placeholder="问题描述：

                1. 详细描述你的问题

                2. 贴上相关代码（请勿用图片代替代码）

                3. 贴上报错信息

                4. 已经尝试过哪些方法仍然没解决（附上相关链接）" ></textarea>
                </div>
                <div class="layui-form-item">
                    <div class="c-tr">
                        <!-- <span>保存中...</span> -->
                        <span>已保存草稿<a href="javascript:;">[舍弃]</a></span>
                        <button class="layui-btn c-ml15" onclick="add()">发布问题</button>
                    </div>
                </div>

        </div>
        </form>
    </div>
</div>

<div class="g-footer">
    <hr>
    <div>Copyright ©2018 技术栈(jishuzhan.club), All Rights Reserved.</div>
    <div>渝ICP备13001123号-2</div>
</div>

<script src="${APP_PATH}/vendor/holder.min.js"></script>
<script src="${APP_PATH}/vendor/layui-v2.4.5/layui/layui.js"></script>
<script src="${APP_PATH}/vendor/layui-v2.4.5/layui-formSelects/dist/formSelects-v4.js"></script>
<%--<script src="${APP_PATH}/js/common.js"></script>--%>
<%--<script src="${APP_PATH}/js/blog-add.js"></script>--%>
<script src="${APP_PATH}/jquery/jquery-2.1.1.min.js"></script>
<script>
    function add() {
        // 获取用户的数据
        var title = $("#title").val();
        var systemType=$("#systemType").val();
        var main=$("#description").val();
        var userId=$("#userId").val();
        var forwardId= $("#sel").val();


        if(title == ''){
            layer.msg("标题不能为空！", {time: 3000, icon: 5, shift: 6}, null);
            return;
        }

        if(systemType == ''){
            layer.msg("请选择一个分类！", {time: 3000, icon: 5, shift: 6}, null);
            return;
        }

        if(main ===''){
            layer.msg("文章不能为空", {time: 3000, icon: 5, shift: 6}, null);
            return;
        }

        $("#form2").submit();

    }
</script>
</body>
</html>
